package com.bite.ioc.controller;

import com.bite.ioc.component.UserComponent;
import com.bite.ioc.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Controller;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User:DELL
 * Date:2025-05-09
 * Time:21:47
 */
@Controller
public class HelloController {
//    @Autowired//依赖注入
    private UserService userService;
//    private UserComponent userComponent;

    //构造方法
//    public HelloController() {
//    }
//
//    public HelloController(UserService userService) {
//        this.userService = userService;
//    }
//    @Autowired
//    public HelloController(UserService userService, UserComponent userComponent) {
//        this.userService = userService;
//        this.userComponent = userComponent;
//    }


    //Setter方法注入
    @Autowired
    public void setUserService(UserService userService) {
        this.userService = userService;
    }
    public void sayHi(){
        userService.doService();
//        userComponent.doComponent();
        System.out.println("Hi,userController...");
    }

}
